package com.ruoyi.system.config;

import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum WarnTypeEnum {
    /**
     * 缺员报警-3-staff  串岗报警-5-staff
     * 离岗报警-6-staff  超员报警-2-staff
     * 静止报警-8-staff  聚集报警-10-staff
     * 作业滞留报警-9-dangerous 作业进场报警-5-dangerous
     * 越界报警-5-car
     */
    WARN_CHAOYUAN(2, "超员报警", "staff"),
    WARN_QUEYUAN(3, "缺员报警", "staff"),
    WARN_CHUANGANG(5, "串岗报警", "staff"),
    WARN_LIGANG(6, "离岗报警", "dangerous"),
    WARN_JINGZHI(8, "静止报警", "dangerous"),
    WARN_JUJI(10, "聚集报警", "dangerous"),
    WARN_ANJIAN(100, "按键报警", "staff");

    private final int code;
    private final String name;
    private final String type;

    public static WarnTypeEnum getWarn(int code) {
        for (WarnTypeEnum warnTypeEnum : values()) {
            if (warnTypeEnum.getCode() == code) {
                return warnTypeEnum;
            }
        }
        return null;
    }

}
